home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / BUS / DynRisk 68k 4.01 demo.sit / DynRisk-Help.rsrc / TEXT_6526.txt < prev    next >
Text File  |  1996-08-30  |  2KB  |  32 lines

  1. Trim2
  2.  
  3. A double trim function. This function separates the input values in three categories defined by the 窶彡窶 and the 窶彭窶 parameters. Assuming that the 窶彡窶 parameter is below the 窶彭窶 parameter, the function behaves as follows:
  4.  
  5. If the input value is less than the 窶彡窶 parameter, the output value is equal to the 窶彙窶 parameter.
  6.  
  7. If the input value is between the 窶彡窶 and the 窶彭窶 parameters, the output value is calculated according to the following linear function:
  8.  
  9.     Output = b + (Input - c)(a - b)/(d - c)
  10.  
  11. If the input value is greater than the 窶彭窶 parameter, the output value is equal to the 窶彗窶 parameter.
  12.  
  13. If the 窶彭窶 parameter is less than or equal to the 窶彡窶 parameter, the 窶彭窶 parameter is ignored, and the function behaves exactly like the Thresh1 function. In such cases you should simply use the Thresh1 function instead to avoid confusion.
  14.  
  15. Note that the 窶彗窶 parameter does not have to be greater than the 窶彙窶 parameter. To obtain useful results, however, the 窶彗窶 parameter should not be equal to the 窶彙窶 parameter. (If you let 窶彗窶 be equal to 窶彙窶, the output value will always be equal to this common value.)
  16.  
  17. In the special case when 窶彗窶 is equal to 窶彭窶, 窶彙窶 is equal to 窶彡窶, and 窶彡窶 is less than 窶彭窶, the Trim2 function takes the following simplified form:
  18.  
  19.     Output = Max(Min(Input, a), b)
  20.  
  21. Hence, in this case input values less than 窶彙窶 are replaced by 窶彙窶, input values greater than 窶彗窶 are replaced by 窶彗窶, and all other input values are passed on unchanged.
  22.  
  23. Default parameter values:
  24.     a = 1, b = 0, c = 0, d = 1
  25.  
  26. Example:
  27.     a = 4, b = 1, c = 2, d = 5
  28.  
  29.     Input = 1  =>  Output = 1
  30.     Input = 4  =>  Output = 3
  31.     Input = 6  =>  Output = 4
  32.